<?php

/**
 * 菜单信息Action
 * @note  实现了对了菜单信息的管理
 * @class  CDXXAction
 * @file  CDXXAction.php
 * @author 赤菁风铃
 * @time  2014年01月08日 19:56:36
 */



/**
 * Class CDXXAction 菜单信息Action
 */
class CDXXAction extends DefaultAction
{

    #region 菜单信息管理功能

    #region 管理首页
    /**
     * 默认进入的管理列表页面
     */
    public function CDXX_Index()
    {

        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_GET) ? $_GET["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_GET) ? $_GET["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_GET['MHCX'];
        $params['YHZXX_BH'] = $_GET['YHZXX_BH'];
        $params['CDXX_MC'] = $_GET['CDXX_MC'];
        #endregion 初始化页面参数

        //处理加密后的外键
        if (!empty($params["YHZXX_BH"])) {
            $params["YHZXX_BH"] = security_decrypt($params["YHZXX_BH"]);
            if ($params["YHZXX_BH"] == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", CDXX::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('CDXX_Index');
    }
    #endregion 管理首页

    #region 数据添加页面
    /**
     * 数据增加初始页面
     */
    public function CDXX_Insert()
    {
        $cdxx = new CDXX($_POST);
        $this->assign("Model", $cdxx);
        $this->display('CDXX_Insert');
    }

    /**
     * 数据增加处理页面
     */
    public function CDXX_Insert_Action()
    {
        $cdxx_bh_ora = security_decrypt($_POST["CDXX_BH_ORA"]);
        if ($cdxx_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }
        $result = ""; //数据插入的结果
        $cdxx = new CDXX($_POST);
        $cdxx_insert = new CDXX();
        $cdxx_insert->CDXX_BH = $cdxx_bh_ora;

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $cdxx_insert->YHZXX_BH = $cdxx->YHZXX_BH; //用户组信息_编号
        $cdxx_insert->CDXX_MC = $cdxx->CDXX_MC; //菜单信息_名称
        $cdxx_insert->CDXX_XSSX = $cdxx->CDXX_XSSX; //菜单信息_显示顺序
        $cdxx_insert->CDXX_TP = $cdxx->CDXX_TP; //菜单信息_图片
        $cdxx_insert->CDXX_BZ = $cdxx->CDXX_BZ; //菜单信息_备注
        $result .= $cdxx_insert->insert();
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据添加页面

    #region 删除数据处理
    /**
     * 根据主键删除单一对象
     */
    public function CDXX_Delete()
    {
        //参数检查
        $cdxx_bh=$_GET['CDXX_BH'];
        if (!empty($cdxx_bh)) {
            $cdxx_bh = security_decrypt($cdxx_bh);
            if ($cdxx_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //删除数据
        $cdxx = new CDXX();
        $result = $cdxx->delete($cdxx_bh);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 删除数据处理

    #region 数据修改页面
    /**
     * 数据修改首页面
     */
    public function CDXX_Update()
    {
        //传入参数检查
        $cdxx_bh=$_GET['CDXX_BH'];
        if (!empty($cdxx_bh)) {
            $cdxx_bh = security_decrypt($cdxx_bh);
            if ($cdxx_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //数据验证
        $cdxx = new CDXX();
        $result = $cdxx->fetch($cdxx_bh);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //进入数据修改页面
        $this->assign("Model",$cdxx );
        $this->display('CDXX_Update');
    }

    /**
     * 数据修改处理页面
     */
    public function CDXX_Update_Action()
    {
        //数据验证
        $cdxx_bh_ora = security_decrypt($_POST["CDXX_BH_ORA"]);
        if ($cdxx_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }

        $cdxx = new CDXX($_POST);

        //检查数据是否存在
        $cdxx_update = new CDXX();
        $result = $cdxx_update->fetch($cdxx_bh_ora);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $cdxx_update->YHZXX_BH = $cdxx->YHZXX_BH; //用户组信息_编号
        $cdxx_update->CDXX_MC = $cdxx->CDXX_MC; //菜单信息_名称
        $cdxx_update->CDXX_XSSX = $cdxx->CDXX_XSSX; //菜单信息_显示顺序
        $cdxx_update->CDXX_TP = $cdxx->CDXX_TP; //菜单信息_图片
        $cdxx_update->CDXX_BZ = $cdxx->CDXX_BZ; //菜单信息_备注
        $result .= $cdxx_update->update($cdxx_bh_ora);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据修改页面

    #region 数据查询
    /**
     * 默认进入的数据查询页面
     */
    public function CDXX_Query()
    {
        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_POST) ? $_POST["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_POST) ? $_POST["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_POST['MHCX'];
        $params['YHZXX_BH'] = $_POST['YHZXX_BH'];
        $params['CDXX_MC'] = $_POST['CDXX_MC'];
        #endregion 初始化页面参数

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", CDXX::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('CDXX_Query');
    }
    #endregion 数据查询

    #endregion 菜单信息管理功能

    #region 菜单项信息管理功能

    #region 管理首页
    /**
     * 默认进入的管理列表页面
     */
    public function CDXXX_Index()
    {

        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_GET) ? $_GET["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_GET) ? $_GET["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_GET['MHCX'];
        $params['CDXX_BH'] = $_GET['CDXX_BH'];
        $params['CDXXX_LX'] = $_GET['CDXXX_LX'];
        $params['CDXXX_MC'] = $_GET['CDXXX_MC'];
        #endregion 初始化页面参数

        //处理加密后的外键
        if (!empty($params["CDXX_BH"])) {
            $params["CDXX_BH"] = security_decrypt($params["CDXX_BH"]);
            if ($params["CDXX_BH"] == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", CDXXX::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('CDXXX_Index');
    }
    #endregion 管理首页

    #region 数据添加页面
    /**
     * 数据增加初始页面
     */
    public function CDXXX_Insert()
    {
        $cdxxx = new CDXXX($_POST);
        $this->assign("Model", $cdxxx);
        $this->display('CDXXX_Insert');
    }

    /**
     * 数据增加处理页面
     */
    public function CDXXX_Insert_Action()
    {
        $cdxxx_bh_ora = security_decrypt($_POST["CDXXX_BH_ORA"]);
        if ($cdxxx_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }
        $result = ""; //数据插入的结果
        $cdxxx = new CDXXX($_POST);
        $cdxxx_insert = new CDXXX();
        $cdxxx_insert->CDXXX_BH = $cdxxx_bh_ora;

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $cdxxx_insert->CDXX_BH = $cdxxx->CDXX_BH; //菜单信息_编号
        $cdxxx_insert->CDXXX_MC = $cdxxx->CDXXX_MC; //菜单项信息_名称
        $cdxxx_insert->CDXXX_XSSX = $cdxxx->CDXXX_XSSX; //菜单项信息_显示顺序
        $cdxxx_insert->CDXXX_LX = $cdxxx->CDXXX_LX; //菜单项信息_类型
        $cdxxx_insert->CDXXX_LJ = $cdxxx->CDXXX_LJ; //菜单项信息_链接
        $cdxxx_insert->CDXXX_TP = $cdxxx->CDXXX_TP; //菜单项信息_图片
        $cdxxx_insert->CDXXX_BZ = $cdxxx->CDXXX_BZ; //菜单项信息_备注
        $result .= $cdxxx_insert->insert();
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据添加页面

    #region 删除数据处理
    /**
     * 根据主键删除单一对象
     */
    public function CDXXX_Delete()
    {
        //参数检查
        $cdxxx_bh=$_GET['CDXXX_BH'];
        if (!empty($cdxxx_bh)) {
            $cdxxx_bh = security_decrypt($cdxxx_bh);
            if ($cdxxx_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //删除数据
        $cdxxx = new CDXXX();
        $result = $cdxxx->delete($cdxxx_bh);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 删除数据处理

    #region 数据修改页面
    /**
     * 数据修改首页面
     */
    public function CDXXX_Update()
    {
        //传入参数检查
        $cdxxx_bh=$_GET['CDXXX_BH'];
        if (!empty($cdxxx_bh)) {
            $cdxxx_bh = security_decrypt($cdxxx_bh);
            if ($cdxxx_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //数据验证
        $cdxxx = new CDXXX();
        $result = $cdxxx->fetch($cdxxx_bh);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //进入数据修改页面
        $this->assign("Model",$cdxxx );
        $this->display('CDXXX_Update');
    }

    /**
     * 数据修改处理页面
     */
    public function CDXXX_Update_Action()
    {
        //数据验证
        $cdxxx_bh_ora = security_decrypt($_POST["CDXXX_BH_ORA"]);
        if ($cdxxx_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }

        $cdxxx = new CDXXX($_POST);

        //检查数据是否存在
        $cdxxx_update = new CDXXX();
        $result = $cdxxx_update->fetch($cdxxx_bh_ora);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $cdxxx_update->CDXX_BH = $cdxxx->CDXX_BH; //菜单信息_编号
        $cdxxx_update->CDXXX_MC = $cdxxx->CDXXX_MC; //菜单项信息_名称
        $cdxxx_update->CDXXX_XSSX = $cdxxx->CDXXX_XSSX; //菜单项信息_显示顺序
        $cdxxx_update->CDXXX_LX = $cdxxx->CDXXX_LX; //菜单项信息_类型
        $cdxxx_update->CDXXX_LJ = $cdxxx->CDXXX_LJ; //菜单项信息_链接
        $cdxxx_update->CDXXX_TP = $cdxxx->CDXXX_TP; //菜单项信息_图片
        $cdxxx_update->CDXXX_BZ = $cdxxx->CDXXX_BZ; //菜单项信息_备注
        $result .= $cdxxx_update->update($cdxxx_bh_ora);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据修改页面

    #region 数据查询
    /**
     * 默认进入的数据查询页面
     */
    public function CDXXX_Query()
    {
        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_POST) ? $_POST["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_POST) ? $_POST["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_POST['MHCX'];
        $params['CDXX_BH'] = $_POST['CDXX_BH'];
        $params['CDXXX_LX'] = $_POST['CDXXX_LX'];
        $params['CDXXX_MC'] = $_POST['CDXXX_MC'];
        #endregion 初始化页面参数

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", CDXXX::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('CDXXX_Query');
    }
    #endregion 数据查询

    #endregion 菜单项信息管理功能

    #region 子菜单信息管理功能

    #region 管理首页
    /**
     * 默认进入的管理列表页面
     */
    public function ZCDXX_Index()
    {

        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_GET) ? $_GET["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_GET) ? $_GET["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_GET['MHCX'];
        $params['CDXXX_BH'] = $_GET['CDXXX_BH'];
        $params['ZCDXX_MC'] = $_GET['ZCDXX_MC'];
        #endregion 初始化页面参数

        //处理加密后的外键
        if (!empty($params["CDXXX_BH"])) {
            $params["CDXXX_BH"] = security_decrypt($params["CDXXX_BH"]);
            if ($params["CDXXX_BH"] == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", ZCDXX::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('ZCDXX_Index');
    }
    #endregion 管理首页

    #region 数据添加页面
    /**
     * 数据增加初始页面
     */
    public function ZCDXX_Insert()
    {
        $zcdxx = new ZCDXX($_POST);
        $this->assign("Model", $zcdxx);
        $this->display('ZCDXX_Insert');
    }

    /**
     * 数据增加处理页面
     */
    public function ZCDXX_Insert_Action()
    {
        $zcdxx_bh_ora = security_decrypt($_POST["ZCDXX_BH_ORA"]);
        if ($zcdxx_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }
        $result = ""; //数据插入的结果
        $zcdxx = new ZCDXX($_POST);
        $zcdxx_insert = new ZCDXX();
        $zcdxx_insert->ZCDXX_BH = $zcdxx_bh_ora;

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $zcdxx_insert->CDXXX_BH = $zcdxx->CDXXX_BH; //菜单项信息_编号
        $zcdxx_insert->ZCDXX_MC = $zcdxx->ZCDXX_MC; //子菜单信息_名称
        $zcdxx_insert->ZCDXX_XSSX = $zcdxx->ZCDXX_XSSX; //子菜单信息_显示顺序
        $zcdxx_insert->ZCDXX_LJ = $zcdxx->ZCDXX_LJ; //子菜单信息_链接
        $zcdxx_insert->ZCDXX_TP = $zcdxx->ZCDXX_TP; //子菜单信息_图片
        $result .= $zcdxx_insert->insert();
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据添加页面

    #region 删除数据处理
    /**
     * 根据主键删除单一对象
     */
    public function ZCDXX_Delete()
    {
        //参数检查
        $zcdxx_bh=$_GET['ZCDXX_BH'];
        if (!empty($zcdxx_bh)) {
            $zcdxx_bh = security_decrypt($zcdxx_bh);
            if ($zcdxx_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //删除数据
        $zcdxx = new ZCDXX();
        $result = $zcdxx->delete($zcdxx_bh);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 删除数据处理

    #region 数据修改页面
    /**
     * 数据修改首页面
     */
    public function ZCDXX_Update()
    {
        //传入参数检查
        $zcdxx_bh=$_GET['ZCDXX_BH'];
        if (!empty($zcdxx_bh)) {
            $zcdxx_bh = security_decrypt($zcdxx_bh);
            if ($zcdxx_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //数据验证
        $zcdxx = new ZCDXX();
        $result = $zcdxx->fetch($zcdxx_bh);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //进入数据修改页面
        $this->assign("Model",$zcdxx );
        $this->display('ZCDXX_Update');
    }

    /**
     * 数据修改处理页面
     */
    public function ZCDXX_Update_Action()
    {
        //数据验证
        $zcdxx_bh_ora = security_decrypt($_POST["ZCDXX_BH_ORA"]);
        if ($zcdxx_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }

        $zcdxx = new ZCDXX($_POST);

        //检查数据是否存在
        $zcdxx_update = new ZCDXX();
        $result = $zcdxx_update->fetch($zcdxx_bh_ora);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $zcdxx_update->CDXXX_BH = $zcdxx->CDXXX_BH; //菜单项信息_编号
        $zcdxx_update->ZCDXX_MC = $zcdxx->ZCDXX_MC; //子菜单信息_名称
        $zcdxx_update->ZCDXX_XSSX = $zcdxx->ZCDXX_XSSX; //子菜单信息_显示顺序
        $zcdxx_update->ZCDXX_LJ = $zcdxx->ZCDXX_LJ; //子菜单信息_链接
        $zcdxx_update->ZCDXX_TP = $zcdxx->ZCDXX_TP; //子菜单信息_图片
        $result .= $zcdxx_update->update($zcdxx_bh_ora);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据修改页面

    #region 数据查询
    /**
     * 默认进入的数据查询页面
     */
    public function ZCDXX_Query()
    {
        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_POST) ? $_POST["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_POST) ? $_POST["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_POST['MHCX'];
        $params['CDXXX_BH'] = $_POST['CDXXX_BH'];
        $params['ZCDXX_MC'] = $_POST['ZCDXX_MC'];
        #endregion 初始化页面参数

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", ZCDXX::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('ZCDXX_Query');
    }
    #endregion 数据查询

    #endregion 子菜单信息管理功能
}